﻿<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"  
    xmlns:p="http://primefaces.org/ui"> 
	<h:head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	    <title>Dodaj ogłoszenie</title>
	</h:head>
	<h:body>
	     <ui:composition template="/template.xhtml">
	        <ui:define name="ui_right">
				<h:form prependId="false">  
				  
				    <p:messages for="adding" /> 
				  
				    <p:panel header="Dodawanie ogłoszenia">  
				        <h:panelGrid columns="2" columnClasses="column" cellpadding="5">  
				            <h:outputText value="Tytuł: "  label="Tytuł" required="true"/>  
				             
				                <p:inputText value="#{advertisementRegBean.advertisement.title}" 
				                required="true" label="Tytuł" style="width:380px;"/>  
				            
				            
				            <h:outputText value="Treść:" label="Treść" required="true" />  
				            
				            	<p:inputTextarea value="#{advertisementRegBean.advertisement.content}"
				            	 required="true" label="Treść" style="width:380px; height:200px"/>
				           
				  
				             <h:outputLabel for="category" value="Kategoria:"/>
								<h:selectOneMenu id="category" value="#{advertisementRegBean.selectedCategory}">
									<f:selectItems value="#{advertisementRegBean.categories}" var="y"
   													itemLabel="#{y.name}" itemValue="#{y.name}"/>
								</h:selectOneMenu>
				              
				            <h:outputLabel for="type" value="Rodzaj oferty:"  label="Rodzaj oferty" required="true"/>
							<h:selectOneMenu id="type" value="#{advertisementRegBean.selectedType}">
									<f:selectItems value="#{advertisementRegBean.types}" var="y"
   													itemLabel="#{y.name}" itemValue="#{y.name}"/>
							</h:selectOneMenu>
			
							<h:outputLabel for="startDate" value="Data rozpoczęcia:"/>
							<p:calendar value="#{advertisementRegBean.advertisement.startDate}" 
							id="popupCal1" label="Data rozpoczęcia" required="true" pattern="dd/mm/yyyy"/>
							
			
							<h:outputLabel for="expireDate" value="Data zakończenia:"/>
							<p:calendar value="#{advertisementRegBean.advertisement.expireDate}" 
							id="popupCal2" label="Data zakończenia" pattern="dd/mm/yyyy"/>
			<!-- 				
			
				            <h:outputText value="Zdjęcia:" />  
				            <h:form enctype="multipart/form-data" prependId="false">
 <p:growl id="messages" showSummary="true" showDetail="true" />
 <p:fileUpload fileUploadListener="#{uploadBean.handleFileUpload}" 
   update="messages"  sizeLimit="1073741824"
   multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;" 
   description="Images"/>
</h:form> -->
								  

								   
				            
				            <p:commandButton value="Dodaj" action="#{advertisementRegBean.trySave}" style="left:400px;" ajax="false"/> 
				        </h:panelGrid>  
				    </p:panel>  
				  
				</h:form>  
	        </ui:define>
	    </ui:composition>
	</h:body>
</html>
